import os
import pymysql
import pytest
from config.config import *


#胶水文件
@pytest.fixture(scope='session',autouse=True)
def destory_data():

    yield

    sqls = [
        'SELECT * from base_data_product ORDER BY create_time desc'
    ]

    con = pymysql.Connect(
        # host=DB_HOST,
        # port=DB_PORT,
        # database=DB_DATABASE,
        # user=DB_USER,
        # passwd=DB_PASSWD,
        **eval(os.environ["DB"]),
        charset=DB_CHARSET,
        autocommit=True
    )
    cur = con.cursor()
    for sql in sqls:
        cur.execute(sql)
    cur.close()
    con.close()
